import { useState } from 'react';

function MouseMove(props) {
    const [points, setPoints] = useState({
        x: 0,
        y: 0
    })

    function handleMouseMove(e) {
        setPoints({
            x: e.clientX,
            y: e.clientY
        })
    }

    return (
        props.children ? props.children({ points, handleMouseMove }) : null
    );
}

export default MouseMove;